#include "widget.h"
#include "ui_widget.h"
#include <QRect>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    setWindowTitle("推箱子");
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()        //up
{
    QRect ret=ui->pushButton_5->geometry();
    ui->pushButton_5->setGeometry(ret.x(),ret.y()-20,ret.width(),ret.height());
}

void Widget::on_pushButton_3_clicked()   //right
{
    QRect ret=ui->pushButton_5->geometry();
    ui->pushButton_5->setGeometry(ret.x()+20,ret.y(),ret.width(),ret.height());
}

void Widget::on_pushButton_2_clicked()   //left
{
    QRect ret=ui->pushButton_5->geometry();
    ui->pushButton_5->setGeometry(ret.x()-20,ret.y(),ret.width(),ret.height());
}

void Widget::on_pushButton_4_clicked()      //down
{
    QRect ret=ui->pushButton_5->geometry();
    ui->pushButton_5->setGeometry(ret.x(),ret.y()+20,ret.width(),ret.height());
}
